package com.hejjon.core.utils;

import com.google.common.base.CaseFormat;
import org.apache.commons.lang3.StringUtils;

import java.util.List;
import java.util.Random;
import java.util.UUID;
import java.util.function.BiConsumer;
import java.util.function.Function;
import java.util.stream.Collectors;

/**
 * @author: cs
 * @date: 2024-12-27 17:15:50
 * @since: 1.0
 */
public class StrUtil {

    public static String getUUID() {
        return UUID.randomUUID().toString().replace("-", "");
    }

    /**
     * 驼峰转下划线格式
     */
    public static String camelToSnakeCase(String camelCase) {
        return CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, camelCase);
    }

    /**
     * 下划线转驼峰
     */
    public static String snakeToCamelCase(String snakeCase) {
        return CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, snakeCase);
    }

    /**
     * 生成5位随机数
     */
    public static String randomInt() {
        Random random = new Random();
        int randomInt = 10000 + random.nextInt(90000);
        return String.valueOf(randomInt);
    }


    /**
     *
     */
    public static String surroundWithOne(String str, String surroundChar) {
        if (StringUtils.isBlank(surroundChar)) {
            return str;
        }
        return surroundChar + str + surroundChar;
    }

    public static void main(String[] args) {
        String s = StrUtil.getUUID();
        System.out.println(s);
    }



}
